﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucListProduct.ascx.cs"
    Inherits="QuocTeViet.AdminCP.PageUC.ucListProduct" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<h2>
    Danh sách Sản phẩm</h2>
<div style="width: 100%; float: left; margin-bottom: 10px;">
    <asp:HiddenField ID="hdfLoaiSanPham" runat="server" />
    <asp:HiddenField ID="hdfNhanHieu" runat="server" />
    <asp:HiddenField ID="hdfKey" runat="server" />
    Danh mục sản phẩm :<asp:DropDownList runat="server"
        ID="drpLoaiSanPham"
        AppendDataBoundItems="true" Width="200px">
        <asp:ListItem Text="--All--" Value="0"></asp:ListItem>
    </asp:DropDownList>
    Nhãn hiệu:<asp:DropDownList runat="server" ID="drpNhanHieu"
        AppendDataBoundItems="true" Width="100px">
        <asp:ListItem Text="--All--" Value="0"></asp:ListItem>
    </asp:DropDownList>
    Từ khóa
    <asp:TextBox ID="txtKey" runat="server" Width="300px"></asp:TextBox>
    <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" 
        onclick="btnSearch_Click" />
</div>
<div style="float: left; width: 100%;">
    <asp:GridView ID="gvProduct" DataKeyNames="SanPhamID" runat="server" AutoGenerateColumns="False"
        Font-Size="12px" BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px"
        CellPadding="4" OnRowDeleting="gvProduct_RowDeleting" OnSelectedIndexChanged="gvProduct_SelectedIndexChanged"
        AllowPaging="True" PageSize="50" Width="100%" OnPageIndexChanging="gvProduct_PageIndexChanging"
        OnRowEditing="gvProduct_RowEditing">
        <RowStyle BackColor="White" ForeColor="#330099" HorizontalAlign="Left" VerticalAlign="Bottom" />
        <Columns>
            <asp:BoundField DataField="TenSanPham" HeaderText="Tên sản phẩm" SortExpression="TenSanPham" />
            <asp:TemplateField HeaderText="Đơn giá">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblDonGia" Text='<%#Eval("DonGia","{0:0,0}") %>'></asp:Label>
                    <asp:TextBox runat="server" ID="txtDonGia" Text='<%#Eval("DonGia") %>' Width="50px"
                        Visible="false"></asp:TextBox>
                </ItemTemplate>
                <EditItemTemplate>
                </EditItemTemplate>
            </asp:TemplateField>
            <%--<asp:BoundField DataField="DonGia" HeaderText="Đơn giá" SortExpression="DonGia" />--%>
            <asp:BoundField DataField="TenLoaiSanPham" ItemStyle-HorizontalAlign="Left" HeaderText="Loại sản phẩm" SortExpression="TenLoaiSanPham" />
            <asp:BoundField DataField="TenNhanHieu" HeaderText="Nhãn hiệu" SortExpression="TenNhanHieu" />
            <asp:TemplateField HeaderText="Xuất xứ">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblXuatXu" Text='<%#Eval("XuatXu")%>' ></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CheckBoxField DataField="SanPhamMoi" ItemStyle-HorizontalAlign="Center" HeaderText="SP nổi bật" />
            <asp:CheckBoxField DataField="SanPhamBanChay" ItemStyle-HorizontalAlign="Center" HeaderText="SP bán chạy" />
            <%--            <asp:TemplateField HeaderText="Hình ảnh">
                <ItemTemplate>
                    <img alt="images" width="100px" height="100px" src='../Media/<%#Eval("HinhAnh") %>' />
                </ItemTemplate>
            </asp:TemplateField>--%>
            <asp:TemplateField HeaderText="Action">
                <ItemTemplate>
                    <asp:ImageButton ID="btEdit" runat="server" CommandName="Select" ImageUrl="~/AdminCP/images/edit_16x16.gif" />
                    <asp:ImageButton ID="btDelete" runat="server" CommandArgument='<%#Eval("SanPhamID") %>'
                        CommandName="Delete" ImageUrl="~/AdminCP/images/delete_16x16.gif" OnClientClick="return confirm('Có muốn xóa bản ghi này? Nhấn OK để xóa!')" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
        <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" VerticalAlign="Middle" />
        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
    </asp:GridView>
    <br />
    <asp:Button ID="btnAdd" runat="server" OnClick="btnAdd_Click" Text="Thêm mới" />
    <asp:Button ID="btnUpdateAll" runat="server" OnClick="btnUpdateAll_Click" Text="Sửa đơn giá" />
    <asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="Cập nhật"
        Visible="false" />
</div>
